# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=zanshin
pkgver=0.5.71
pkgrel=1
# Blocked on armhf by qt5-qtdeclarative
# Blocked on mips, ppc64le and s390x by akonadi-calendar
arch="all !armhf !ppc64le !s390x !mips !mips64"
url="https://zanshin.kde.org/"
pkgdesc="A Getting Things Done application which aims at getting your mind like water"
license="(GPL-2.0-only OR GPL-3.0-only) AND LGPL-2.0-or-later"
makedepends="extra-cmake-modules qt5-qtbase-dev boost-dev akonadi-calendar-dev kontactinterface-dev krunner-dev kwindowsystem-dev ki18n-dev"
checkdepends="xvfb-run dbus"
source="https://download.kde.org/stable/zanshin/zanshin-$pkgver.tar.xz"
subpackages="$pkgname-lang"

build() {
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	# tests-units-akonadi-akonadistoragetest, tests-units-akonadi-akonadicachingstorageintegrationtest,
	# tests-units-presentation-alltaskspagemodeltest, tests-units-widgets-editorviewtest,
	# tests-units-widgets-pageviewtest, tests-units-migrator-zanshin021migrationtest,
	# tests-units-migrator-zanshincontextitemsmigrationtest are broken
	local skipped_tests="("
	local tests="
		tests-units-akonadi-akonadistoragetest
		tests-units-akonadi-akonadicachingstorageintegrationtest
		tests-units-presentation-alltaskspagemodeltest
		tests-units-widgets-editorviewtest
		tests-units-widgets-pageviewtest
		tests-units-migrator-zanshin021migrationtest
		tests-units-migrator-zanshincontextitemsmigrationtest"
	for test in $tests; do
		skipped_tests="$skipped_tests|$test"
	done
	skipped_tests="$skipped_tests)"
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE xvfb-run ctest -E "$skipped_tests"
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
}

sha512sums="47b4fa8797dd50372dcf176198e1c80348cd1ba604d1ed61cd973956e54ba5551caea33c766d857bc3ad598bd0eae9882ffc315e13e6e3b9c1033d01c8e029d8  zanshin-0.5.71.tar.xz"
